package concurrent.mycondition.CSmodel;

import static concurrent.mycondition.CSmodel.MiddlewareChannel.max_capacity;

/**
 * 生产者
 * @author jiajie
 *
 */
public class Producer implements Runnable{
    private final MiddlewareChannel middlewareChannel;
    private String threadName;
    private String message;


    /**
     * 构造通道类
     */
    public Producer(MiddlewareChannel middlewareChannel) {
        this.middlewareChannel = middlewareChannel;
    }

    /**
     * 生产消息
     */
    @Override
    public void run() {
//		while (true) {
//			System.out.println(Thread.currentThread().getName());
//			middlewareChannel.send(message);
//		}

        for (int i = 0; i < max_capacity; i++) {
//			System.out.println(Thread.currentThread().getName());
            middlewareChannel.send();
        }
    }


}